package com.example.myapplication.widgets.calendar.work;

import android.graphics.RectF;
import android.text.TextUtils;

import com.example.myapplication.utils.TimeUtils;

public class TimeWork {
    private String mId;
    private int mBgColor;
    private String mTitle;
    private String mSubTitle;
    private String mTip;
    private int mWeek; // 1-7
    private String mDate; // 年月日
    private String mTime; // 00  00:00   00:00:00  三种都可以，只使用到小时，月日历可以不进行设置

    // UI绘制使用
    private RectF rectF; // 对应的坐标

    public String getId() {
        return mId;
    }

    public void setId(String id) {
        mId = id;
    }

    public int getBgColor() {
        return mBgColor;
    }

    public void setBgColor(int bgColor) {
        mBgColor = bgColor;
    }

    public String getTitle() {
        return mTitle;
    }

    public void setTitle(String title) {
        mTitle = title;
    }

    public String getSubTitle() {
        return mSubTitle;
    }

    public void setSubTitle(String subTitle) {
        mSubTitle = subTitle;
    }

    public String getTip() {
        return mTip;
    }

    public void setTip(String tip) {
        mTip = tip;
    }

    public String getTime() {
        return mTime;
    }

    public void setTime(String time) {
        mTime = time;
    }

    public String getDate() {
        return mDate;
    }

    public String getDay(){
        if (TextUtils.isEmpty(mDate)) return "0";
        mDate = mDate.replace("/", "-");
        if (!mDate.contains("-")) return mDate;
        return mDate.substring(mDate.lastIndexOf("-") + 1);
    }

    public void setDate(String date) {
        // 因为会使用日期进行大小对比判断，所以分隔符必须是一样的，进行转行操作，避免不一样
        mDate = date.replace("/", "-");
        mWeek = TimeUtils.getDayOfWeekMonday(date);
    }

    public int getWeek() {
        return mWeek;
    }

    public RectF getRectF() {
        return rectF;
    }

    public void setRectF(RectF rectF) {
        this.rectF = rectF;
    }
}
